/*
 * @Author: zlc
 * @Date: 2022-06-16 22:23:58
 * @LastEditTime: 2022-07-27 17:12:55
 * @LastEditors: zlc
 * @Description: 是否登录
 * @FilePath: \teachernotice\common\mixin\mixinLogin.js
 */
  import { mapState } from 'vuex';
  export default{
    data() {
      return {}
    },
    computed: {
		...mapState({
			jxyUserInfo: state => state.User.userInfo.jxyUserInfo,
			userProfile: state => state.User.userInfo.userProfile,
			wxUserId: state => state.User.userInfo.wxUserId
		}),
		isUserLogin() {
			return this.jxyUserInfo.token && this.wxUserId.unionid
		}
	},
    methods: {
      // ____checkGetData(this)
      // 初始化数据
      logInStatusTackl(loginType='needLogin',options={}) {
        options=Object.assign({loginType},options)
        if(this.jxyUserInfo.token && this.wxUserId.unionid){
            if(this.jxyUserInfo.relateStatus === 'noSchool' || !this.jxyUserInfo.teachSubject){
              uni.reLaunch({
                url:'/packageA/pages/login/loginSuccess' + `?relateStatus=${this.jxyUserInfo.relateStatus}&phone=''`
              }); 
			         return 'loginSuccess'
            }
        }
       
        if (!this.jxyUserInfo.token && !this.wxUserId.unionid&&loginType=='needLogin') {
          uni.reLaunch({
              url: `/packageA/pages/login/login?loginType=${options.loginType}`
            });
            return 'login'
        }
      },
    },
    mounted() {},
  }
  